<html>
   <head>
      <script type="text/javascript">
         function writekeycode(event){
            document.getElementById('keycode').value=event.keyCode
            document.getElementById('charcode').value=event.charCode
            document.getElementById('which').value=event.which
            document.getElementById('isChar').value=event.isChar
         }
         
         function focusFile(){
            document.getElementById('filefield').click();
         }
         
         function writecharcode(event){
            document.getElementById('charcode').value=event.charCode
         }
         
         </script>
   </head>
   <body>
      onkeydown: 
      <input type="text" onkeydown="writekeycode(event)" onkeypress="//writekeycode(event)">
      onkeypress: 
      <input type="text" onkeypress="writekeycode(event); return false">
      keycode<input id="keycode" type="text">
      charcode<input id="charcode" type="text">
      which<input id="which" type="text">
      isChar<input id="isChar" type="text">
      <input id="button1" type="button" onclick="alert('')">
      <input type="button" onclick="document.getElementById('filefield').click()">
      <input id="filefield" type="file">
            
   </body>
</html>